/**
 * @description: Ip
 */

import type { CommonAPI } from '../types/all'
import { defHttp } from '../http'

/** ip列表 */
export const getComputeIpListApi: CommonAPI<'/v1/compute/ip', 'get'> = params =>
  defHttp.get(`/v1/compute/ip`, { params })

/** 删除实例绑定的ip */
export const deleteComputeIpBindApi: CommonAPI<
  '/v1/compute/ip/bind',
  'delete'
> = params => defHttp.delete(`/v1/compute/ip/bind`, { params })

/** 绑定实例 */
export const postComputeIpBindApi: CommonAPI<
  '/v1/compute/ip/bind',
  'post'
> = data => defHttp.post(`/v1/compute/ip/bind`, data)

/** 更换ip */
export const postComputeIpChangeApi: CommonAPI<
  '/v1/compute/ip/change',
  'post'
> = data => defHttp.post(`/v1/compute/ip/change`, data)

/** 变更ip的过期时间 */
export const updateComputeIpExpireApi: CommonAPI<
  '/v1/compute/ip/expire',
  'put'
> = data => defHttp.put(`/v1/compute/ip/expire`, data)

/** 创建失败，重试创建实例 */
export const addComputeIpRetryCreateApi: CommonAPI<
  '/v1/compute/ip/retry_create',
  'post'
> = data => defHttp.post(`/v1/compute/ip/retry_create`, data)

/** 外部网络的子网列表 */
export const getComputeIpSubnetListApi: CommonAPI<
  '/v1/compute/ip/subnet',
  'get'
> = params => defHttp.get(`/v1/compute/ip/subnet`, { params })

/** 解绑实例 */
export const postComputeIpUnbindApi: CommonAPI<
  '/v1/compute/ip/unbind',
  'post'
> = data => defHttp.post(`/v1/compute/ip/unbind`, data)
